﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using System;

namespace VisionCloud.Domain
{
    /// <summary>
    /// 实现 IModelBinderProvider接口，包装上面实现的模型绑定器
    /// </summary>
    public class MyModelBinderProvider : IModelBinderProvider
    {
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            return new BinderTypeModelBinder(typeof(MyModelBinder));
        }
    }
}
